import Vue from 'vue'
import VueRouter from "vue-router";
import myIndex from "@/pages/myIndex.vue"
import page2 from '@/pages/page2.vue'
import page3 from '@/pages/page3.vue'
import miaosha from '@/pages/miaosha.vue'
import submitData from '@/pages/submitData.vue'
import questionTable from '@/pages/questionTable.vue'

Vue.use(VueRouter)

export default new VueRouter({
  routes: [
    {
      path: "/",
      component: myIndex,
    },
    {
      path: "/page2",
      component: page2,
    }, {
      path: "/page3",
      component: page3,
    }, {
      path: "/questionTable",
      component: questionTable,
    },{
      path: "/miaosha",
      component: miaosha,
    },{
      path: "/submitData",
      component: submitData,
    },
    {
      path: "/updateQ",
      component: resolve=>(require(["@/components/updateQ.vue"],resolve))
      ,
    },
    {
      path: "/updateA",
      component: resolve=>(require(["@/components/updateA.vue"],resolve))
      ,
    },
    {
      path: "/stByAid",
      component: resolve=>(require(["@/pages/submitDataByAnswerer.vue"],resolve))
      // submitDataByQuestioner.vue
      ,
    },
    {
      path: "/stByQid",
      component: resolve=>(require(["@/pages/submitDataByQuestioner.vue"],resolve))
      // submitDataByQuestioner.vue
      ,
    },
  ]
})


// 避免重复点击报错
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch(err => err)
}
